#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
url = "https://www.runoob.com/python/python-tutorial.html"
try:
    r = requests.get(url)
    r.raise_for_status()
    r.encoding = r.apparent_encoding
    print(r.text[:1000]) #内容前1000字符
except:
    print("爬取失败")
